"""
    类中的函数就叫做方法
"""
class Animal():
    """
        对于含self参数的方法
        类来调用时会将self当作位置参数,需要显式传入
        实例调用时self无需传入,它指代类的实例
    """
    def say(self):
        print(self)

    def walk():
        print("go")
    
    def other(hello):
        print(hello)

"""
Traceback (most recent call last):
    ...
    Animal.say()
TypeError: Animal.say() missing 1 required positional argument: 'self'
"""
# Animal.say()

my_dog = Animal()
# <__main__.Animal object at 0x72d4b1f9ac60>
my_dog.say()

"""
    不含self的方法,
"""
Animal.walk()#'go'
"""
Traceback (most recent call last):
    ...
    my_dog.walk()
TypeError: Animal.walk() takes 0 positional arguments but 1 was given
"""
# my_dog.walk()


"""
    self只是我们对位置参数取得名字
"""
# <__main__.Animal object at 0x73044a5aaf60>
my_dog.other()